//package com.tbvtc.agriculturalcreditchainserver2025.config;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Slf4j
//@Configuration
//public class WebMvcConfig implements WebMvcConfigurer {
//    @Value("${agri.chat.voice.storage-path}")
//    private String voiceStoragePath;
//
//    @Value("${agri.chat.voice.access-path}")
//    private String voiceAccessPath;
//
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        log.info("访问路径前缀：{}", voiceAccessPath); // 应输出：/api/voice/
//        log.info("存储路径：{}", voiceStoragePath); // 应输出：D:/agri/voice/（带结尾/）
//        log.info("最终URL匹配规则：{}", voiceAccessPath + "**"); // 应输出：/api/voice/**
//        registry.addResourceHandler(voiceAccessPath + "**")
//                .addResourceLocations("file:" + voiceStoragePath);
//    }
//}